package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Import;

public interface UserMapper {
    @Insert("insert into user(id,phone,status) values (null,#{phone},#{status})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    Integer save(User user);
    //Integer save(@Param("Phone") String phone,@Param("status") Integer status);

    //根据手机号查询
    @Select("select *from user where phone=#{phone}")
    User findByPhone(String phone);

    //根据id查询用户对象
    @Select("select * from user where id=#{userId}")
    User findById(Long userid);
}
